<template>
  <view class="wrapper">
    <button @tap="clickFun">1111</button>
  </view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

function clickFun() {
  get().then((res) => {
    console.log(res)
  })
}

function get() {
  const promise = new Promise((resolve, reject) => {
    uni.request({
      url: 'https://pcapi-xiaotuxian-front-devtest.itheima.net/home/banner',
      method: 'GET',
      success: (success) => {
        console.log('uni.request成功了', success)
        resolve(success)
      },
    })
  })
  return promise
}
</script>

<style lang="scss">
.wrapper {
  width: 100%;
  height: 200px;
  background-color: aquamarine;
  position: relative;
  text {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
  }
  button {
    position: absolute;
  }
  .addBtn {
    top: 60%;
    left: 30%;
  }
  .removeBtn {
    top: 60%;
    left: 60%;
  }
}
</style>
